/*
 *Copyright (c) 2024 Black Sesame Technologies
 *
 *Licensed under the Apache License, Version 2.0 (the "License");
 *you may not use this file except in compliance with the License.
 *You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *Unless required by applicable law or agreed to in writing, software
 *distributed under the License is distributed on an "AS IS" BASIS,
 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *See the License for the specific language governing permissions and
 *limitations under the License.
*/

#ifndef _IPC_TRANS_LAYER_H
#define _IPC_TRANS_LAYER_H

#include "bst_ipc_config.h"
#include "ipc_serdes.h"

// this header file is used by ipc_app_layer
// common api

// server api only
int32_t ipc_trans_layer_stub_create_handle(const uint8_t endid,
					   const uint8_t fid, const uint8_t sid,
					   const uint8_t cid, uint8_t *handle);
int32_t ipc_trans_layer_stub_get_method_msg(const uint8_t endid,
					    const uint8_t handle,
					    serdes_t *msg);
int32_t ipc_trans_layer_stub_send_reply_msg(const uint8_t endid,
					    const uint8_t handle,
					    serdes_t *msg);
int32_t ipc_trans_layer_stub_send_broadcast(const uint8_t endid,
					    const uint8_t handle,
					    serdes_t *msg);

int32_t ipc_trans_layer_register_method(const uint8_t endid,
					const uint8_t handle,
					const uint8_t cmd);
int32_t ipc_trans_layer_unregister_method(const uint8_t endid,
					  const uint8_t handle);

// client api only
int32_t ipc_trans_layer_proxy_create_handle(const uint8_t endid,
					    const uint8_t fid,
					    const uint8_t sid,
					    const uint8_t cid, uint8_t *handle);
int32_t ipc_trans_layer_proxy_get_reply_msg(const uint8_t endid,
					    const uint8_t handle,
					    serdes_t *msg);
int32_t ipc_trans_layer_proxy_get_broadcast_msg(const uint8_t endid,
						const uint8_t handle,
						serdes_t *msg);
int32_t ipc_trans_layer_proxy_send_method(const uint8_t endid,
					  const uint8_t handle, serdes_t *msg);

int32_t ipc_trans_layer_destroy_handle(const uint8_t endid,
				       const uint8_t handle);
int32_t ipc_trans_layer_query_info(const uint8_t endid, const uint8_t handle);
int32_t ipc_trans_layer_release_recv_wait(const uint8_t endid,
					  const uint8_t handle);

#define QUERY_INFO_HAS_AVAIL_RECV_MSG 0
#define QUERY_INFO_DST_STS_OFFLINE 1
#define QUERY_INFO_DST_STS_ONLINE 2
#endif
